#!/usr/bin/env python
# encoding: utf-8
"""
helpal_models.py

Created by Mohammad Khatib on 2008-11-07.
Copyright (c) 2008 __MyCompanyName__. All rights reserved.
"""

import sys
import os

from google.appengine.ext import db
from google.appengine.api import users

# DataStores
class HelpalUser(db.Model):
	user = db.UserProperty()
	

class Question(db.Model):
	title = db.StringProperty(required=True)
	description = db.TextProperty()
	author = db.ReferenceProperty(HelpalUser)
	when  = db.DateTimeProperty(auto_now=True)
	
class Answer(db.Model):
	question = db.ReferenceProperty(Question)
	author = db.ReferenceProperty(HelpalUser)
	when  = db.DateTimeProperty(auto_now=True)

# User Has Many Votes on Answers
class Vote(db.Model):
	answer = db.ReferenceProperty(Answer)
	voter = db.ReferenceProperty(HelpalUser)
	value = db.IntegerProperty(default=0)
	when  = db.DateTimeProperty(auto_now=True)